<?php namespace Common\Model;

use Hdphp\Model\Model;

//收藏表
class UserJob extends Model{
	//定义模型
	protected $table = "user_job";

	//添加收藏
	public function store(){
		$uid=Q('post.uid',0,'intval');
		$jid=Q('post.jid',0,'intval');
		$row=$this->add(array(
			'lg_job_jid'=>$jid,
			'lg_user_uid'=>$uid
		));
		if ($row) return true;
		return false;
	}

	//取消收藏
	public function del(){
		$uid=Q('post.uid',0,'intval')?Q('post.uid',0,'intval'):$_SESSION['homeInfo']['uid'];
		$jid=Q('post.jid',0,'intval')?Q('post.jid',0,'intval'):Q('get.jid',0,'intval');
		$row=$this->where("lg_user_uid=$uid AND lg_job_jid=$jid")->delete();
		if ($row) return true;
		return false;
	}


}